package com.fh.service.impl;

import com.fh.mapper.UserAddrMapper;
import com.fh.model.ProductParams;
import com.fh.model.UserAddr;
import com.fh.service.UserAddrService;
import com.fh.utils.ResultState;
import com.fh.vo.ResultVo;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserAddrServiceImpl implements UserAddrService {

    @Resource
    private UserAddrMapper userAddrMapper;


    @Override
    public ResultVo selectUserAddr(Integer userId) {
        Example example = new Example(UserAddr.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId",userId);
        criteria.andEqualTo("status",1);
        List<UserAddr> userAddrs = userAddrMapper.selectByExample(example);


        return new ResultVo(ResultState.OK,"ok",userAddrs);
    }
}
